<!DOCTYPE html>
<html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue Template</title>
</head>
<body>
    <div id="app">
        <my-com></my-com>
        <cpnn></cpnn>
    </div>
    <div id="app1">
        <my-com></my-com>
    </div>
<script src="../js/vue.js"></script>
<script>
    // 全局组件
    const com = Vue.extend({
        template: `
            <div>
                <h1>我是标题</h1>
                <p>我是内容，哈哈哈哈</p>
                <p>我是内容，全局组件</p>
            </div>
        `
    })

    //局部组件
    const cpnn = Vue.extend({
        template: `
            <div>
                <h1>我是标题</h1>
                <p>我是内容，哈哈哈哈</p>
                <p>我是内容，局部组件</p>
            </div>
        `
    })

    Vue.component('my-com',com)

    const app = new Vue({
        el: '#app',
        data: {
            message: 'hello Vue!'
        },
        components:{
            cpnn: cpnn
        }
    })

    const app1 = new Vue({
        el:'#app1'
    })
</script>
</body>
</html>